package com.ct.ecommerce.framework.enums;

/**
 * @author changtong
 * @date 2021-50-20
 */
public enum PayStatusEnum {
    /**
     * 支付状态：0待支付 1已支付 2支付失败 3取消支付
     */
    ToBePaid(0, "待支付"),
    Paid(1, "已支付"),
    Failure(2, "支付失败"),
    Cancel(3, "取消支付");

    private final int value;

    private final String showName;

    PayStatusEnum(int value, String showName) {
        this.value = value;
        this.showName = showName;
    }

    public static PayStatusEnum valueOf(int value) {
        for (PayStatusEnum s : PayStatusEnum.values()) {
            if (s.value == value) {
                return s;
            }
        }
        throw new IllegalArgumentException(String.format("值%s不能转换成枚举", value));
    }


    public String getShowName() {
        return showName;
    }

    public int getValue() {
        return value;
    }
}
